#include "IIC_HAL_QG.h"

void vfnIIC_Address(uint8 u8address) 
{
    IICA = u8address;  
}

void vfnIIC_BaudRate(uint8 u8rate)
{
    IICF = u8rate;  
}

void vfnIIC_Enable(void)
{
    IICC_IICEN = 1;
}

void vfnIIC_Disable(void)
{
    IICC_IICEN = 0;
}

void vfnIIC_EnableInterrupts (void)
{
    IICC_IICIE = 1;
}

void vfnIIC_DisableInterrupts (void)
{
    IICC_IICIE = 0;
}

void vfnIIC_ModeSelect (uint8 u8mode)
{
    IICC_MST = u8mode;
}

void vfnIIC_Reset (void)
{
    IICC_RSTA = 1;
}

void vfnIIC_EnableAcknowledge (void)
{
    IICC_TXAK = 0;
}

void vfnIIC_DataDirection (uint8 u8mode)
{
    IICC_TX = u8mode;
}

uint8 u8IIC_TransferComplete (void)
{
    return IICS_TCF;
}

uint8 u8IIC_CheckIfAdressed (void)
{
    return IICS_IAAS;
}

uint8 u8IIC_BusBusy (void)
{
    return IICS_BUSY;
}

uint8 u8IIC_ArbitrationLost (void)
{
    return IICS_ARBL;
}

uint8 u8IIC_SlaveStatus (void)
{
    return IICS_SRW;
}

uint8 u8IIC_CheckInterrupt (void)
{
    return IICS_IICIF; 
}

uint8 u8IIC_AckReceived (void)
{
    return IICS_RXAK;
}

void vfnIIC_SendData (uint8 u8data)
{
    IICD=u8data;
}

uint8 u8IIC_ReadData (void)
{
    return IICD;
}